import type { BuildData, BuildParams, EnterpriseDetail, EnterpriseListData, EnterpriseListParams, EnterpriseParams, Industry } from "@/types/enterprise"
import { request } from "@/utils/reuqest"
import type { UploadData } from "element-plus"

export const getEnterpriseListAPI = (params:EnterpriseListParams) => {
  return request<EnterpriseListData>('/park/enterprise','GET',params)
}

export const EnterpriseIndustryAPI = () => {
  return request<Industry[]>('/park/industry')
}

export const UploadAPI = (fd: FormData) => {
  return request<UploadData>('upload','POST',fd)
}

/**
 * 添加企业信息
 * @param params 
 * @returns 
 */
export const EnterpriseAddAPI = (params: Partial<EnterpriseParams>) => {
  return request('/park/enterprise','POST',params)
}

/**
 * 获取企业详情
 * @param {*} id
 * @returns
 */
export const getEnterpriseDetailAPI = (id: string) => {
  return request<EnterpriseDetail>(`/park/enterprise/${id}`)
}

/**
 * 修改企业信息
 * @param {*} params
 * @returns
 */
export const uploadEnterpriseAPI = (params: Partial<EnterpriseParams>) => {
  return request('/park/enterprise','PUT',params)
}

/**
 * 删除企业信息
 * @param {*} id
 * @returns
 */
export const delEnterpriseAPI = (id: string) => {
  return request(`/park/enterprise/${id}`,'DELETE')
}

/**
 * 获取楼宇列表
 * @param {*} params  
 * @returns
 */
export const getBuildingListAPI = (params: BuildParams) => {
  return request<BuildData>('/park/building','GET',params)
}